<{include file="Public/top.html" }>
</head>
<div id="warpper">
    <div class="content">
        <div class="location">卡券管理</div>
        <{include file="Card/nav.html"}>
        <div class="filedSet" style="padding-bottom: 0;">
            <div class="search">
                <form action="" id="searchForm" class="ui-form reportForm">
                    <input name="m" type="hidden" value="<{$module}>">
                    <input name="c" type="hidden" value="<{$controller}>">
                    <input name="a" type="hidden" value="<{$action}>">

                    <input name="p" id="page" type="hidden" value="<{$page|default:1}>">
                    <input name="limit" id="limit" type="hidden" value="<{$limit|default:10}>">
                    <input name="ofield" id="ofield" type="hidden" value="<{$ofield}>">
                    <input name="otype"  id="otype"  type="hidden" value="<{$otype}>">

                    <div class="ui-form-item inline-block">
                        <label class="ui-label">关键字</label>
                        <input type="text" class="ui-text bg-text keyword" value="<{$keyword}>" name="keyword" placeholder="卡券名" />
                    </div>
                    <div class="ui-form-item inline-block">
                        <button type="submit" class="ui-button" onclick="LayerShow();">查询</button>
                    </div>
                </form>
            </div>
        </div>

        <!--表格内容-->
        <div class="mainGrid">
            <table class="ui-table ui-body">
                <thead>
                <tr>
                    <th class="pct10">卡券名</th>
                    <th class="pct10">生成者</th>
                    <th class="pct10">是否全部<br />上传微信</th>
                    <th class="pct10">库存</th>
                    <th class="pct10">累积总数</th>
                    <th class="pct10">核销数量</th>
                    <th class="pct10">领取人数</th>
                    <{*<th class="pct10">状态</th>*}>
                    <th class="pct15 last-col">操作</th>
                </tr>
                </thead>
                <tbody>
                <{if $list}>
                    <{foreach from = $list item=item}>
                    <tr>
                        <td><{$item.title}></td>
                        <td><{$item.authorName}></td>
                        <td><{$item.plat}><br />
                            <{if $item.platformSwitch eq $CARD_PLATFORM_BOTH}>
                                <{if $item.isDeposit eq 1}>是<{else}>否<{/if}>
                                <br />
                                <{if $item.weixinCheck eq 1}>
                                    审核通过
                                <{elseif $item.weixinCheck eq 2}>
                                    审核不过
                                <{else}>
                                    审核中
                                <{/if}>
                            <{/if}>
                        </td>
                        <td><{$item.stock}></td>
                        <td><{$item.totalNum}></td>
                        <td><{$item.consumeNum}></td>
                        <td><{$item.num}></td>
                        <td class="ta_l">
                            <div class="handler">
                                <a href="<{u('Card/record?cardId='|cat:$item['id'])}>" onclick="LayerShow();">使用记录</a>
                                <!--<span class="sep">|</span>-->
                                <!--<a href="<{u('Card/edit?id='|cat:$item['id'])}>" onclick="LayerShow();">修改</a>-->
                                <span class="sep">|</span>
                                <{if $item.status == $smarty.const.ENABLE_ENABLE}>
                                <a href="<{u('cardUpdate/?id='|cat:$item['id'])}>" onclick="if(!confirm('确定不启用该卡券么？'))return false;">已启用</a>
                                <{else}>
                                <a href="<{u('cardUpdate/?id='|cat:$item['id'])}>" onclick="if(!confirm('确定启用该卡券么？'))return false;">未启用</a>
                                <{/if}>
                                <{if $item.weixinBind eq 1}>
                                <{if $item.isDeposit eq 0}>
                                <span class="sep">|</span>
                                <a href="javascript:void(0)" onclick="depositWeixinCode(<{$item.id}>)">上传</a>
                                <{/if}>
                                <{/if}>

                            </div>
                        </td>
                    </tr>
                    <{/foreach}>
                <{else}>
                    <tr><td colspan="8">暂无数据</td></tr>
                <{/if}>
                </tbody>
            </table>
        </div>
        <!--描述：分页-->
        <div class="pagination">
            <{include file="Public/page.html"}>
        </div>
    </div>
</div>
<script>
    function depositWeixinCode(cardId){
        var data={'cardId':cardId};
        $.ajax({
            url:"<{U('Card/ajaxDepositCode')}>",
            dataType:"json",
            data:data,
            type:"POST",
            success:function(obj){
                if(obj.status == 0){
                    depositWeixinCode(cardId);
                    layer.msg(obj.msg);
                }else{
                    layer.msg(obj.msg);
                }
            },
        });
    }
</script>
<body>
<{include file="Public/foot.html" }>